package com.atqinke.designpattern.structuraltype.combination;

/**
 * @BelongsProject: BasicConnection
 * @BelongsPackage: com.atqinke.DesignPattern.structuraltype.combination
 * @Author: NieHk
 * @CreateTime: 2022-08-28  20:03
 * @Description: MenuItem是菜单项，不能再有子菜单，所以添加菜单，移除菜单和获取子菜单的功能并不能实现。
 * @Version: 1.0
 */
public class MenuItem extends MenuComponent {

    public MenuItem(String name,int level) {
        this.name = name;
        this.level = level;
    }

    @Override
    public void print() {
        for (int i = 1; i < level; i++) {
            System.out.print("--");
        }
        System.out.println(name);
    }
}
